/**
 * Copyright 2010 Insigma Technology. 
 * All rights reserved.
 *
 * "test.java is for what: "
 * 
 * Create by Ray at 2012-6-10 下午12:44:01.
 * Ray [email:shilei@insigma.com.cn]
 * 
 * Revision History
 *
 * Date            Programmer                   Notes
 * ---------    ---------------------  -----------------------------------
 * 2012-6-10            Ray                       initial
 **/

package util;

import java.net.URL;
import java.util.Calendar;

import org.htmlparser.Node;
import org.htmlparser.NodeFilter;
import org.htmlparser.Parser;
import org.htmlparser.filters.NodeClassFilter;
import org.htmlparser.filters.TagNameFilter;
import org.htmlparser.tags.LinkTag;
import org.htmlparser.util.NodeList;
import org.htmlparser.visitors.HtmlPage;


public class test {
	
	
	
	public static void main(String[] args) {
		try {
//			Class.forName("com.mysql.jdbc.Driver");
//			Connection connection = DriverManager.getConnection(GlobalParams.DB_URL);
//			PreparedStatement preparedStatement = null;
//			String sql = "select * from match_user where user_name = ? and user_pwd=? and user_state = ? ";
//			preparedStatement = connection.prepareStatement(sql);
//			preparedStatement.setString(1, "user");
//			preparedStatement.setString(2, "123123");
//			preparedStatement.setString(3, GlobalParams.STATE_NORMAL);
//			ResultSet rs = preparedStatement.executeQuery();
//			rs.last();
//			System.out.println("result-->"+rs.getRow());
			
//			Integer aa = 100;
//			Integer bb = 9;
//			BigDecimal bigDecimal = new BigDecimal(aa*1.0/bb);
//			bigDecimal.setScale(2, RoundingMode.HALF_DOWN);
//			Float cc = aa*1.0F/bb;
//			System.out.println("cc--->"+cc);
//			System.out.println("bigDecimal--->"+bigDecimal);
//			System.out.println("dd--->"+bigDecimal.setScale(2, BigDecimal.ROUND_HALF_DOWN));
//			String aa = "2012-06-10 20:30:00.0";
//			String[] bb = aa.split("\\.");
//			System.out.println("size-->"+bb.length);
//			System.out.println("bb-->"+bb[0]);
//			String aa = "<asdasdas>>><<";
//			System.out.println("result-->"+aa.replaceAll("<", "&lt").replaceAll(">", "&gt"));
			
//			testUrl();
			
			System.out.println(Calendar.getInstance().getTimeInMillis());
			
		} catch (Exception e) {
			// TODO: handle exception
			e.printStackTrace();
		}
	}
	
	
	public static void testUrl(){
		try {
			Parser parser = new Parser("http://nba.hupu.com/schedule/");
			NodeFilter filter = new TagNameFilter("table");
			NodeList list = parser.parse(filter);
			
//			HtmlPage page = new HtmlPage(new Parser("http://nba.hupu.com/schedule/"));
//			NodeList list = page.getBody();
			Node table = list.elementAt(0);
			
//			NodeFilter filter = new NodeClassFilter();
//		    Parser parser = new Parser();
//		    parser.setURL("http://nba.hupu.com/schedule/");
//		    parser.setEncoding(parser.getEncoding());
//		    NodeList list = parser.extractAllNodesThatMatch(filter);
//		    for (int i = 0; i < list.size(); i++) {
//		        Node node = list.elementAt(i);
//		        System.out.println("--------------------------------" + node.toHtml(false));
//		    }
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	
	
	
	
}
